#ifndef __TINYTIMER_H_
#define __TINYTIMER_H_

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>


#ifdef __cplusplus
extern "C"
{
#endif

#define MAX_TIMER_COUNT (10)
#define tiny_timer_id   int

typedef void (*tinytimer_cb)(void *user);

typedef struct tinytimer_t
{
     int interval; //没有单位，根据传入的ticks计算间隔
     char use_flag; //使用标志
     char reverse[3]; //保留
     void *userdata;  
     tinytimer_cb cb;
     long long timeout;
}tinytimer;

/*-1 error*/
tiny_timer_id tiny_timer_add(int interval, tinytimer_cb cb, void *userdata);
/*-1 error 0 successed*/
int tiny_timer_del(tiny_timer_id timer_id);
int tiny_timer_schedule(long long ticks);

#ifdef __cplusplus
}
#endif

#endif